import json
from typing import Optional, Dict, Any
from loguru import logger
from configs import logging_config


def load_json_file(file_path: str) -> Dict[str, Any]:
    with open(file_path, 'r', encoding='utf-8') as file:
        datas = json.load(file)
    return datas


def load_data(file_path: str) -> Optional[dict]:
    try:
        return load_json_file(file_path)
    except Exception as e:
        logger.error(f"Failed to load JSON file: {file_path}. Error: {e}")
        return None
